package com.example.android.story.Utils;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

/**
 * Created by android on 18-5-21.
 */

@Dao
public interface ActorDao {
    @Insert
    public void insert(Actor actor);

    @Query("delete from _actor")
    public void deleteAll();

    @Delete
    public void deleteActor(Actor ... actor);

    @Update
    public void updateActor(Actor ... actor);

    @Query("select * from _actor")
    public LiveData<List<Actor>> getAllActorsLiveData();

    @Query("select * from _actor")
    public List<Actor> getAllActors();

    @Query("select * from _actor where actor_name=:actor_name")
    public LiveData<Actor> getActorLiveData(String actor_name);

    @Query("select * from _actor where actor_name=:actor_name")
    public Actor getActor(String actor_name);

}
